﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id ="2021000116683002";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key ="MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDm1ZZH8bfZaGnSGecOm6MKTiXmSDGCH6jC2biPo+Sw2qB3X9gTQ5kGtoP4Myeh9nPyHR7L71Cv8sOR0DQp0LM6m4vO5j1y2faFhPJyLDKsqcV1Pob116/22KQDaqYx1e7fPOzfRpLErFbIMI1YIeumbjvH/bUbDs4Q+Nz/BaMMnuEmIgzG++W01afUVmlalcvzRExasT2Oitsv08VaLyVGeyrTx7q7h57vDnJDRvjbp/w8Zw3/t+XbblTuUm0WyjSIDsoWoWrONTB8cAdAcAHL7NUMks3RfFSNFA3FUwMYZ6IqwWlrkZMy6PuqeFQGtKPqKA5l9yDRqkHu9E9gbKAjAgMBAAECggEAANPlPQ7N1Pa94mX7YR8Hv6K2GhRKMShB56j2M3Wn/UZbavIqCS+l3dNLt9kfHEKQ+d5G3P5XsLnTH7O6bCf2bJBgOPa0Y7QKYUIvyF8GM35MWfZGb509YUo3lFeOjwEwYRaL1uUe45ummAMsjpNYj/k3N6leO+GatY7e4/82LXZmo+a31dCeqnEnR/herlMQm2lpIxXEs/izDFZReY0ukTCQWHGz2gjRf3Qxi07h0VHa1uYpvf02nuEADI6btzM2iIj/heEx7VzB+2ACAbFmCJnQUiOwCUez/ciOoIM326N6bP5HFV7WWeirKWM8DrIY1Mrms2RKMNZ4Bo3XCCpagQKBgQD3oPuBRN0RMHCI8bgGMf2rd8beNaNkhdHuDB6IaCk17rdWNO3IgG9M204uBbhzE7p1mkbBn/9OYmaCmJZ3ukILCLSnF9bgwfSMuBQqKJVV0K0e22BfX6JKTmg1Fz3JukT4pU1xO6e8Bd6p2VlSD2Eu1ZOyFOFQQ/qGWBhx1Pqc4wKBgQDuo0Mny7OMjU6Lr8yFQwQMWsotVRbLJ+AfNdPx69xo8k/Gczl83cTzAZFtFvb22s3C0PdLHmhncLqOL/rYKFH8BMO90Vhd3cDPMmVAjRBZMMs8PBTTyl+8XsEvwMVMCvpJJNKpDA0A2SNMTw4utLTtB8x4Ui9TI0y/6/m6reKTwQKBgFUrlHWgxtxbqckgQmg3F4W7W7YgAsPXVx4mIvZNxSbcpUhMSiC1NBLeNySTKR7DgVVjq8R7EGfYZmOyscYaVQ7Qfrod8/U4ILGpup3JeZube3/qelozXXFrSGJCTSkuHPzcdidlGksMRcprjFIyIf3mzbbpgZmG2AsPD9FPLKd7AoGATIg7j1W63Yar/AyDUPGvKK8tS+CQENNXA2tl754u79FWWFS3yR3ufeiw1QWaaoy9lI8j4Al+fj4e9l7Y2d4EfQiiJgwvhNsLbOfCpTMYXSJS65xxKYMrtOPGnSP7omma3z5Z+TEOMolw0pY//CakJ6hqoOPqnYUipiJt0rrVgYECgYEAz+25RiSh1bfASzRRW/LWQobFo3TVFYywXSnuwpLGyD2Bb3gaqBQXtXQ/Mf1gCezsEbHNOU+OWjXhOmVt+CCWEq0M9QhxvnQZo0FgFeiw2GIL/HhOECVBsPehMUzBxTQ7HgGPZvcinIUGvMnnsvrJyc0H5jibFOOd9kyPm6Y27Uc=";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoxyhQLix5coxgr4KvLIThby4CaPVTUehb15TbU6cclX5swrKhlwfv5OSwRzzm5piaGJ9hpaxIYAMedqziVfjFcRiRqLfKXLWq0CFPKtmdnc3IajOFjXmOCDThhNjSiBiDNjspdwnFlXchFIz9tl/FHzSJXhBVBTEYwb28wniQhnLpSYnQGBwH2iH1cVSS535HI/zEXwNlqKBpfbp3teII5fjLxH1+EiF6V0IyPTWmnQaxFTe90+m+BTmaL1wPRzPFq8ChDc6OfhmEeiXH1CU0MZza91TIZEn9W37m0l4nszXIcW+U//cXSqzpsSq0dWcKaeZilHlTbajTTAS0a5NVwIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/shoppingsix/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/shoppingsix/my-account";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

